package library;

import java.io.Serializable;

/**
 * Created by v on 17-5-18.
 */
public class Book implements Serializable{
    private int id;
    private String name;
    private double price;
    private int amount;
    private String author;

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    public int getAmount() {
        return amount;
    }

    public int getId() {
        return id;
    }

    public String getAuthor() {
        return author;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public Book(){}

    public Book(int id, String name, double price, int amount, String author){
        this.id=id;
        this.name=name;
        this.price=price;
        this.amount=amount;
        this.author=author;
    }

    public Book(String name, double price, int amount, String author){
        this(-1,name,price,amount,author);
    }

    @Override
    public String toString() {
        String str=String.format("id=%d&name=%s&price=%f&amount=%d&author=%s"
                ,id,name,price,amount,author);

        return str;
    }
}
